//if ie
/*
behaviorUserdata = function(udObj) {
	var me = this;
	var loaded = '';	//当前已载入的文件名
	this.udObj = udObj;
	this.udObj.style.behavior = 'url(#default#userdata)';
	this.value = this.udObj.value;
	//this.inhtml = this.udObj.innerHTML;

	//检查文件是否存在,存在est=undefined并返回true否则返回false
	this.exist = function(filename){
		try{
			me.udObj.load(filename);//将文件名为 filename的 XML 载入
			me.loaded = filename;
			return true;
		}catch(e){ return false;}        
    }
	//预加载
	this.preLoad = function(filename){
		if(me.loaded=='' || me.loaded!=filename){me.exist(filename);}
		return me.loaded;
	}
	//获取指定的属性值
	this.getAtrib = function(filename,atrib){
		if(me.preLoad(filename)!='')
		{
			var val = me.udObj.getAttribute(atrib);
			return val==null?"":val;
		}return "";
	}
	//移除对象的指定属性
	this.remAtrib = function(filename,atrib){
		me.udObj.removeAttribute(atrib);
		me.udObj.save(filename);	//将对象数据保存到名为filename的XML文件里面
		return true;
	}
	//设置指定的属性值
	this.setAtrib = function(filename,atrib,val,expire){
		var etime = typeof(expire)=="undefined"?24*60*60:expire;
		me.udObj.expires = me.setExpire(etime);
		me.udObj.setAttribute(atrib,val);
		me.udObj.save(filename);
	}
	//设置一个系列的对象数据(即整个XML文件)失效
	this.remPartion = function(filename){
		if(me.exist(filename))
		{
			me.udObj.expires = me.setExpire(-1);
			me.udObj.save(filename);
		}
	}
	//设置有效期
	this.setExpire = function(sec){
		var oTimeNow = new Date();
		oTimeNow.setSeconds(oTimeNow.getSeconds() + parseInt(sec));
		return oTimeNow.toUTCString();
	}
}*/

/* begin: cross page variable setting */
SiteData = {
	init:function() {
		if($.browser.msie) {
        	this.ie_init();
		}else if($.browser.mozilla||(isChrome=navigator.userAgent.indexOf("Chrome/")>0)){
			this.mozilla_init();
		}
	},
	mozilla_init:function() {},
	ie_init:function() {
		document.documentElement.addBehavior("#default#userdata");
	},
	set_entry:function(key,value,timeout) {
		if($.browser.msie) {
			this.ie_set_entry(key,value,timeout);
		}else if($.browser.mozilla||(isChrome=navigator.userAgent.indexOf("Chrome/")>0)){
			this.mozilla_set_entry(key, value, timeout);
		}
	},
	ie_set_entry:function(key,value,timeout) {
		var ex;
		var oTimeNow = new Date();
		oTimeNow.setSeconds(oTimeNow.getSeconds() + parseInt(timeout));

		with(document.documentElement)try {
			load(key);
			setAttribute("value", value);
			expires=oTimeNow.toUTCString();
			save(key);
			return getAttribute("value");
		} catch (ex){alert("ie_set_entry:" + ex.message)}
	},
	mozilla_set_entry:function(key,value,timeout) {
		var oTimeNow = new Date();
		oTimeNow.setSeconds(oTimeNow.getSeconds() + parseInt(timeout));
		$.cookie(key,value,{expires: oTimeNow});
	},
	get_value:function(key) {
		if($.browser.msie) {
			return this.ie_get_value(key);
		}else if($.browser.mozilla||(isChrome=navigator.userAgent.indexOf("Chrome/")>0)){
			return this.mozilla_get_value(key);
		}
	},
	ie_get_value:function(key) {
		var ex;
		with(document.documentElement)try {
			load(key);
			return getAttribute("value");
		} catch (ex){
			alert(ex.message);
			return null;
		}
	},
	mozilla_get_value:function(key) {
		return $.cookie(key);
	},
	del_entry:function(key) {
		if($.browser.msie) {
			this.ie_del_entry(key);
		}else if($.browser.mozilla||(isChrome=navigator.userAgent.indexOf("Chrome/")>0)){
			this.mozilla_del_entry(key);
		}
	},
	ie_del_entry:function(key) {
		var ex; 
		with(document.documentElement)try{
			load(key);
			expires = new Date(315532799000).toUTCString();
			save(key);
		} catch (ex){alert(ex.message);}
	},
	mozilla_del_entry:function(key) {
		$.cookie(key,null);
	},
	set_expire:function(key, value, timeout) {
		if($.browser.msie) {
			this.ie_set_expire(key,timeout);
		}else if($.browser.mozilla||(isChrome=navigator.userAgent.indexOf("Chrome/")>0)){
			this.mozilla_set_expire(key, value, timeout);
		}
	},
	ie_set_expire:function(key,timeout) {
		var ex;
		var oTimeNow = new Date();
		oTimeNow.setSeconds(oTimeNow.getSeconds() + parseInt(timeout));

		with(document.documentElement)try {
			load(key);
			expires=oTimeNow.toUTCString();
			save(key);
			return getAttribute("value");
		} catch (ex){alert("ie_set_entry:" + ex.message)}
	},
	mozilla_set_expire:function(key,value,timeout) {
		var oTimeNow = new Date();
		oTimeNow.setSeconds(oTimeNow.getSeconds() + parseInt(timeout));
		$.cookie(key,value,{expires: oTimeNow});
	}
};
SiteData.init();
//SiteData.del_entry('chatty')
/* end: cross page variable setting */